package wq.gdky005.util;

import android.app.Dialog;
import android.content.Context;
import android.widget.ProgressBar;

/**
 * 这里是把所以的Dialog抽出来！为了简化代码量！
 * @author wangqing
 * 2013-5-27
 */
public class CustomDialog {
	private static ProgressBar progress;
	public static Dialog progressDialog;

	public static void showDialog(Context context, boolean cancancle) {
		showDialog(context, "正在努力加载数据...", cancancle);
	}

	//自定义对话框
	public static void showDialog(Context context, String str, boolean cancancle) {
		if (progressDialog != null) {
			Canncle();
		}
//		progressDialog = new Dialog(context, R.style.MyDialogActivity);
//
//		ViewGroup v = (ViewGroup) LayoutInflater.from(context).inflate(
//				R.layout.general_progressbar, null);
//		TextView text = (TextView) v.getChildAt(1);
//		text.setText(str);

//		progressDialog.setContentView(v);
		progressDialog.setCancelable(cancancle);
		progressDialog.show();
	}


	public static void Canncle() {
		if (progressDialog != null) {
			progressDialog.cancel();
			progressDialog = null;
			if (progress != null)
				progress = null;
		}
	}
}
